package com.silong.controller;

import com.silong.entity.ResultMap;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * Created by CYY on 2017/4/22.
 */
public class BaseController {
    @Autowired
     HttpServletRequest request;
    @Autowired
   HttpServletResponse response;
    @Autowired
      HttpSession session;

    public HttpServletRequest getRequest() {
        return request;
    }

    public void setRequest(HttpServletRequest request) {
        this.request = request;
    }

    public HttpServletResponse getResponse() {
        return response;
    }

    public void setResponse(HttpServletResponse response) {
        this.response = response;
    }

    public HttpSession getSession() {
        return session;
    }

    public void setSession(HttpSession session) {
        this.session = session;
    }
    public ResultMap getResultMap(String msg,int code,Object object){
        ResultMap result= null;

       if (object==null){
           result=new ResultMap(msg,code);
       }else{
           result= new ResultMap(msg,code,object);

       }
        return result;
    }
}
